
fn normal_expression() {
    // variable binding
    let x = 5;

    // expression;
    // here compiler will report a warning:path statement with no effect
    x;
    // the compiler will report a warning:unused arithmetic operation that must be used
    x + 1;
    15;
    println!("in normal_expression, x is {}", x);
}

fn block_expression() {
    let x = 5u32;
    let y = {
        let x_squared = x * x;
        let x_cube = x_squared * x;
        // this expression will be assigned to `y`
        x_cube + x_squared + x
        
    }; // i guess here cant missing ;, we will try. um~, what i guess is right

    let z = {
        // the semicolon suppresses this expression and `()` is assigned to `z`
        // the compiler will report a warning:unused arithmetic operation that must be used
        2 * x;
    };

    // print the value of variables
    println!("in block_expression, x is {:?}", x);
    println!("in block_expression, y is {:?}", y);
    println!("in block_expression, z is {:?}", z);
}

fn main() {
    normal_expression();
    block_expression();
}